package com.qjdchina.sku.util;

import java.io.IOException;

import org.springframework.core.io.support.PropertiesLoaderUtils;

public class ProductModeUtil {
    public static boolean isOnlineMode() throws IOException {
        String productMode = PropertiesLoaderUtils.loadAllProperties("product.properties").getProperty("product.mode");
        if (productMode == null) {
            return false;
        }
        return productMode.equalsIgnoreCase("online");
    }

    public static boolean isDevMode() throws IOException {
        String productMode = PropertiesLoaderUtils.loadAllProperties("product.properties").getProperty("product.mode");
        if (productMode == null) {
            return false;
        }
        return productMode.equalsIgnoreCase("dev");
    }

    public static boolean isTestMode() throws IOException {
        String productMode = PropertiesLoaderUtils.loadAllProperties("product.properties").getProperty("product.mode");
        if (productMode == null) {
            return false;
        }
        return productMode.equalsIgnoreCase("test");
    }
}
